# dbmysql.py
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import sessionmaker
from sqlalchemy import text
import logging


from spiders.config import DATABASE_URI

logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)

# 创建数据库连接
engine = create_engine(DATABASE_URI)

# 创建数据库会话
Session = sessionmaker(bind=engine)
session = Session()

def get_session():
    return session
